package com.zsrt.java.day20170103.lh.daily.demo12;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * throw new RuntimeException 利用throw放大抛出异常
 */
import org.junit.Test;

public class ExceptionTest {
	
	@Test
	public void testName() throws Exception {
		
		
		
	}
	
	public void xx() throws Exception{
		
		//运行时异常
		int a=0;
		
		//编辑异常
		InputStream is=null;
		
		try {
			a = 10/0;
			is = new FileInputStream("aa.txt");
		}catch (FileNotFoundException e) {
			e.printStackTrace();
		}finally{
			try {
				if(is !=null){
					is.close();
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		System.out.println(a);
	}
	

	
	public void xx1(){
		//1.加载驱动类
//		Class.forName("com.mysql.jdbc.Driver");
		
		//2.获得链接
//		Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
		
		
	}
	
}
